# 通义千问 API 配置示例
# 请复制此文件为 config.py 并填入你的实际 API Key

# 方式1: 直接在代码中设置（不推荐用于生产环境）
DASHSCOPE_API_KEY = "***"

# 方式2: 使用环境变量（推荐）
# 在终端中设置：export DASHSCOPE_API_KEY="your-api-key"
# 或在 .env 文件中设置：DASHSCOPE_API_KEY=your-api-key

# API 使用示例
API_USAGE_EXAMPLES = {
    "chat_with_function_call": {
        "url": "POST /api/qwen/chat",
        "description": "与通义千问聊天，支持函数调用",
        "request_body": {
            "message": "北京今天天气怎么样？",
            "api_key": "your-api-key"  # 可选，如果设置了环境变量
        },
        "curl_example": '''
curl -X POST http://localhost:5000/api/qwen/chat \
  -H "Content-Type: application/json" \
  -d '{
    "message": "北京今天天气怎么样？",
    "api_key": "your-api-key"
  }'
'''
    },
    "get_functions": {
        "url": "GET /api/qwen/functions",
        "description": "获取可用的函数列表",
        "curl_example": "curl http://localhost:5000/api/qwen/functions"
    },
    "execute_function": {
        "url": "POST /api/qwen/function",
        "description": "直接执行特定函数",
        "request_body": {
            "function_name": "calculate_math",
            "arguments": {
                "expression": "2+3*4"
            }
        },
        "curl_example": '''
curl -X POST http://localhost:5000/api/qwen/function \
  -H "Content-Type: application/json" \
  -d '{
    "function_name": "calculate_math",
    "arguments": {
      "expression": "2+3*4"
    }
  }'
'''
    }
}

# 可用的函数说明
AVAILABLE_FUNCTIONS = {
    "get_weather_info": {
        "description": "获取天气信息",
        "parameters": {
            "location": "地点名称（必需）",
            "date": "日期（可选）"
        },
        "example": {
            "function_name": "get_weather_info",
            "arguments": {
                "location": "北京",
                "date": "今天"
            }
        }
    },
    "calculate_math": {
        "description": "计算数学表达式",
        "parameters": {
            "expression": "数学表达式（必需）"
        },
        "example": {
            "function_name": "calculate_math",
            "arguments": {
                "expression": "(10+5)*2-3"
            }
        }
    },
    "search_info": {
        "description": "搜索信息",
        "parameters": {
            "query": "搜索关键词（必需）",
            "category": "搜索分类（可选）"
        },
        "example": {
            "function_name": "search_info",
            "arguments": {
                "query": "人工智能",
                "category": "tech"
            }
        }
    }
}